<template>
	<el-tabs v-model="activeName" @tab-click="handleClick">
		<el-tab-pane label="订单中心" name="first">
			<div style="display: inline-block;">
				<div style="position: relative;display: inline-block;margin: 3px;">
					<span>订单类型：</span>
					<el-select v-model="type" style="width:150px;margin-left: 10px;" @change="animeDat(type)">
						<el-option v-for="item in typeNum" :key="item.value" :label="item.label" :value="item.value">
						</el-option>
					</el-select>&nbsp;&nbsp;&nbsp;
				</div>
				<div style="position: relative;display: inline-block;margin: 3px;">
					<span>状态：</span>
					<el-select v-model="status" style="width:150px;margin-left: 10px;" @change="animeDat(status)">
						<el-option v-for="item in statesnum" :key="item.value" :label="item.label" :value="item.value">
						</el-option>
					</el-select>&nbsp;&nbsp;&nbsp;&nbsp;
				</div>
				<div style="position: relative;display: inline-block;margin: 3px;">
					<span>医院：</span>
					<el-select v-model="hospitalId" filterable style="width:150px;margin-left: 10px;"
						@change="animeDat(hospitalId)">
						<el-option v-for="item in hospitalList" :key="item.hospitalId" :label="item.hospitalName"
							:value="item.hospitalId">
						</el-option>
					</el-select>&nbsp;&nbsp;&nbsp;
				</div>
				<div style="position: relative;display: inline-block;margin: 3px;">
					<span>接单用户：</span>
					<el-input style="width: 200px;" @keydown.enter.native="select" placeholder="请输入下单用户"
						v-model="userNameX"></el-input>&nbsp;&nbsp;
				</div>
				<div style="position: relative;display: inline-block;margin: 3px;">
					<span>下单用户：</span>
					<el-input style="width: 200px;" @keydown.enter.native="select" placeholder="请输入接单用户"
						v-model="userName"></el-input>&nbsp;&nbsp;
				</div>
				<div style="position: relative;display: inline-block;margin: 3px;">
					<span>订单编号：</span>
					<el-input style="width: 200px;" @keydown.enter.native="select" placeholder="请输入订单编号"
						v-model="ordersNo"></el-input>&nbsp;&nbsp;
				</div>
				<div style="margin:5px;display: inline-block;">
					<span>开始时间：</span>
					<el-date-picker style="width: 160px;margin-left: 10px;" v-model="startTime" align="right"
						type="datetime" format="yyyy-MM-dd" value-format="yyyy-MM-dd" placeholder="选择开始时间">
					</el-date-picker>&nbsp;&nbsp;&nbsp;
				</div>
				<div style="margin:5px;display: inline-block;">
					<span>截止时间：</span>
					<el-date-picker style="width: 160px;margin-left: 10px;" v-model="endTime" align="right"
						type="datetime" format="yyyy-MM-dd" value-format="yyyy-MM-dd" placeholder="选择截止时间">
					</el-date-picker>
				</div>
				<el-button style="margin-left:15px;" size="mini" type="primary" icon="document" @click="select">查询
				</el-button>
				<el-button style="margin-left:15px;" size="mini" type="primary" icon="document" @click="cleans">重置
				</el-button>
				<el-button style='margin-left:15px;' size="mini" type="warning" icon="document"
					@click="exportBtn">导出Excel
				</el-button>
			</div>
			<div style="color: orange;"> * 导出订单提示：导出订单前请进行时间或者状态等筛选，否则导出订单量过多易出现卡顿或系统崩溃</div>
			<el-table v-loading="tableDataLoading" :data="tableData.records" height="50vh">
				<el-table-column prop="ordersId" label="编号" width="80" fixed="left">
				</el-table-column>

				<el-table-column prop="userName" label="下单用户">
					<template slot-scope="scope"> <!--  -->
						<el-button size="mini" style="color: #008000;background: #fff;border: none;padding: 0;" type="primary"
							:disabled="!isAuth('userList:details')" @click="updates(scope.row.userId)">
							{{scope.row.ordersUserName ? scope.row.ordersUserName : '未绑定'}}
						</el-button>
						<!-- <span style="color: #008000;cursor: pointer;" @click="updates(scope.row.userId)"
							v-if="scope.row.ordersType==1">{{ scope.row.ordersUserName }}</span>
						<span style="color: #008000;cursor: pointer;" @click="updates(scope.row.userId)"
							v-if="scope.row.ordersType==2">{{ scope.row.ordersUserName }}</span> -->
					</template>
				</el-table-column>
				<el-table-column prop="userName" label="接单用户">
					<template slot-scope="scope">
						<span v-if="scope.row.state==0"> - </span>
						<span v-else style="color: #009900;cursor: pointer;" @click="updates(scope.row.orderTakingUserId)" >{{ scope.row.userName?scope.row.userName:'未绑定' }}</span>
					</template>
				</el-table-column>
				<el-table-column prop="ordersNo" label="订单编号" width="150">
				</el-table-column>
				<el-table-column prop="ordersType" label="订单类型">
					<template slot-scope="scope">
						<span v-if="scope.row.ordersType==1">陪诊订单</span>
						<span v-if="scope.row.ordersType==2">陪护订单</span>
					</template>
				</el-table-column>
				<el-table-column prop="appointInformation.hospitalName" label="医院名称" width="150">
				</el-table-column>
				<el-table-column prop="hospitalImg" label="医院照片" width="200">
					<template slot-scope="scope">
						<div v-if="scope.row.appointInformation&&scope.row.appointInformation.hospitalImg">
							<img v-for="(item,index) in scope.row.appointInformation.hospitalImg.split(',')"
								:key="index" :src="item" width="40" height="40" style="margin:3px" />
						</div>
					</template>
				</el-table-column>

				<el-table-column prop="appointInformation.departmentName" label="科室" width="150">
				</el-table-column>
				<el-table-column prop="appointInformation.type" label="服务类型">
					<template slot-scope="scope">
						<span v-if="scope.row.appointInformation&&scope.row.appointInformation.type==1">陪诊</span>
						<span v-if="scope.row.appointInformation&&scope.row.appointInformation.type==2">陪护</span>
						<span v-if="scope.row.appointInformation&&scope.row.appointInformation.type==3">助浴</span>
						<span v-if="scope.row.appointInformation&&scope.row.appointInformation.type==4">护理</span>
					</template>
				</el-table-column>
				<el-table-column prop="appointInformation.serviceName" label="服务名称">
				</el-table-column>
				<el-table-column prop="appointInformation.tags" label="服务标签" width="160">
				</el-table-column>
				<el-table-column prop="img" label="服务照片" width="200">
					<template slot-scope="scope">
						<div v-if="scope.row.appointInformation&&scope.row.appointInformation.img">
							<img v-for="(item,index) in scope.row.appointInformation.img.split(',')" :key="index"
								:src="item" width="40" height="40" style="margin:3px" />
						</div>
					</template>
				</el-table-column>
				<el-table-column prop="appointInformation.patientInfo.realName" label="预约人姓名" width="150">
					<template slot-scope="scope">
						<span v-if="scope.row.appointInformation&&scope.row.appointInformation.patientInfo">
							<span v-if="scope.row.appointInformation.patientInfo">
								{{scope.row.appointInformation.patientInfo.realName}}
							</span>

						</span>
						<!-- <span style="cursor: pointer;color: #4f9dec;" @click="dataDel(scope.row,4)">查看详情</span> -->
					</template>
				</el-table-column>
				<el-table-column prop="appointInformation.departmentName" label="就诊信息" width="150">
					<template slot-scope="scope">
						<span style="cursor: pointer;color: #4f9dec;"
							@click="dataDel(scope.row.appointInformation,4)">查看详情</span>
					</template>
				</el-table-column>
				<el-table-column prop="appointInformation.patientInfo.emergencyPhone" label="紧急联系人电话" width="160">
				</el-table-column>
				<el-table-column prop="couponMoney" label="优惠券金额" width="120">
					<template slot-scope="scope">
						<span>{{scope.row.couponMoney?scope.row.couponMoney:'0'}}</span>
					</template>
				</el-table-column>
				<el-table-column prop="sfZhiRate" label="上级师傅佣金" width="120">
					<template slot-scope="scope">
						<!-- <span style="color: #DD0000;cursor: pointer;"
							@click="updates(scope.row.sfZhiUserId)">{{scope.row.sfZhiRate?scope.row.sfZhiRate:'0'}}</span> -->
							<el-button size="mini" style="color: #DD0000;background: #fff;border: none;padding: 0;" type="primary"
								:disabled="!isAuth('userList:details')" @click="updates(scope.row.sfZhiUserId)">
								{{scope.row.sfZhiRate ? scope.row.sfZhiRate : '0'}}
							</el-button>
					</template>
				</el-table-column>
				<el-table-column prop="rate" label="陪诊/陪护佣金" width="120">
					<template slot-scope="scope">
						<span>{{scope.row.rate?scope.row.rate:'0'}}</span>
					</template>
				</el-table-column>

				<el-table-column prop="zhiRate" label="推广员佣金" width="120">
					<template slot-scope="scope">
						<!-- <span style="color: #DD0000;cursor: pointer;"
							@click="updates(scope.row.zhiUserId)">{{scope.row.zhiRate?scope.row.zhiRate:'0'}}</span> -->
							<el-button size="mini" style="color: #DD0000;background: #fff;border: none;padding: 0;" type="primary"
								:disabled="!isAuth('userList:details')" @click="updates(scope.row.zhiUserId)">
								{{scope.row.zhiRate ? scope.row.zhiRate : '0'}}
							</el-button>
					</template>
				</el-table-column>
				<el-table-column prop="feiRate" label="代理商佣金" width="120">
					<template slot-scope="scope">
						<!-- <span style="color: #DD0000;cursor: pointer;"
							@click="updates(scope.row.feiUserId)">{{scope.row.feiRate?scope.row.feiRate:'0'}}</span> -->
							<el-button size="mini" style="color: #DD0000;background: #fff;border: none;padding: 0;" type="primary"
								:disabled="!isAuth('userList:details')" @click="updates(scope.row.feiUserId)">
								{{scope.row.feiRate ? scope.row.feiRate : '0'}}
							</el-button>
					</template>
				</el-table-column>
				<el-table-column prop="pingRate" label="平台金额">
					<template slot-scope="scope">
						<span>{{scope.row.pingRate?scope.row.pingRate:'0'}}</span>
					</template>
				</el-table-column>
				<el-table-column prop="payMoney" label="支付金额">
					<template slot-scope="scope">
						<span style="color: #f56c6c;">{{scope.row.payMoney}}</span>
					</template>
				</el-table-column>
				<el-table-column prop="appointInformation.hopeTime" label="预约时间" width="160">
					<template slot-scope="scope">
						<span v-if="scope.row.appointInformation">{{scope.row.appointInformation.hopeTime}}</span>
						<el-button size="mini" type="primary" plain :disabled="!isAuth('orderCenter:update')"
							@click="updateBz(scope.row.appointInformation)" style="margin:5px;">修改</el-button>
					</template>
				</el-table-column>
				<el-table-column prop="appointInformation.remarks" label="备注" width="200">
					<template slot-scope="scope">
						<span v-if="scope.row.appointInformation">{{scope.row.appointInformation.remarks}}</span>
						<el-button size="mini" type="primary" plain :disabled="!isAuth('orderCenter:update')"
							@click="updateBz(scope.row.appointInformation)" style="margin:5px;">修改</el-button>
					</template>
				</el-table-column>
				<!-- <el-table-column prop="orderImg" label="图片" width="200">
					<template slot-scope="scope">
						<div v-if="scope.row.orderImg">
							<div v-for="(item,index) in scope.row.orderImg.split(',')" :key="index">
								<el-popover placement="top-start" title="" trigger="hover">
									<img  :src="item" width="40" height="40" style="margin:3px" slot="reference" />
									<img  :src="item" width="200" height="200" style="margin:3px" />
									
								</el-popover>
							</div>
						</div>
					</template>
				</el-table-column> -->
				<el-table-column prop="imgRemarks" label="图片备注" width="200">
					<template slot-scope="scope">
						<div v-if="scope.row.appointInformation&&scope.row.appointInformation.imgRemarks">
							<div v-for="(item,index) in scope.row.appointInformation.imgRemarks.split(',')" :key="index"
								style="display: inline-block;margin: 3ox;">
								<el-popover placement="top-start" title="" trigger="hover">
									<img :src="item" width="40" height="40" style="margin:3px" slot="reference" />
									<img :src="item" width="200" height="200" style="margin:3px" />

								</el-popover>
							</div>
						</div>
					</template>
				</el-table-column>
				<el-table-column prop="code" label="确认码">
				</el-table-column>
				<el-table-column prop="isTransfer" label="是否是转单" fixed="right" width="100">
					<template slot-scope="scope">
						<span style="color: #999;" v-if="scope.row.isTransfer==1">是</span>
						<span style="color: #999;" v-else>否</span>
					</template>
				</el-table-column>
				<el-table-column prop="state" label="订单状态" fixed="right">
					<template slot-scope="scope">
						<span style="color: #f56c6c;" v-if="scope.row.state==0">待支付</span>
						<span style="color: #E87D0D;" v-if="scope.row.state==1">进行中</span>
						<span style="color: #E87D0D;" v-if="scope.row.state==5">待服务</span>
						<span style="color: #009900;" v-if="scope.row.state==2">已完成</span>
						<span style="color: #999;" v-if="scope.row.state==3">已取消</span>
						<span style="color: #999;" v-if="scope.row.state==4">待接单</span>
					</template>
				</el-table-column>
				<el-table-column prop="createTime" label="创建时间" width="160">
				</el-table-column>
				<el-table-column prop="createTime" fixed="right" label="操作" width="200">
					<template slot-scope="scope">


						<el-button size="mini" type="primary" v-if="scope.row.state === 1||scope.row.state === 5"
							:disabled="!isAuth('orderCenter:wancheng')" @click="wancheng(scope.row)"
							style="margin: 3px;">完成</el-button>
						<el-button size="mini" type="primary" v-if="scope.row.state === 1||scope.row.state === 5"
							:disabled="!isAuth('orderCenter:nojorder')" @click="qvxiao(scope.row.ordersId,'取消接单')"
							style="margin: 3px;">取消接单</el-button>
						<el-button size="mini" type="primary" v-if="scope.row.state === 1 || scope.row.state === 5"
							:disabled="!isAuth('orderCenter:wancheng')" @click="zhuandan(scope.row)"
							style="margin: 3px;">转单</el-button>
						<el-button size="mini" type="primary" v-if="scope.row.state === 0||scope.row.state === 4"
							:disabled="!isAuth('orderCenter:noorder')" @click="qvxiao(scope.row.ordersId,'取消订单')"
							style="margin: 3px;">取消订单</el-button>

						<el-button size="mini" type="primary" plain
							v-if="scope.row.state === 1||scope.row.state === 5||scope.row.state === 4"
							:disabled="!isAuth('orderCenter:tuikuan')" @click="tuikuanBtn(scope.row,0)"
							style="margin: 3px;">全部退款</el-button>
						<el-button size="mini" type="primary" v-if="scope.row.state === 4"
							:disabled="!isAuth('orderCenter:wancheng')" @click="zhuandan(scope.row,'pd')"
							style="margin: 3px;">派单</el-button>
						<!-- <el-button size="mini" type="warning"
							v-if="scope.row.state === 1||scope.row.state === 5||scope.row.state === 4"
							:disabled="!isAuth('orderCenter:tuikuan')" @click="tuikuanBtn2(scope.row)"
							style="margin: 3px;">部分退款</el-button> -->
						<el-button size="mini" type="danger" :disabled="!isAuth('orderCenter:delete')"
							@click="deletes(scope.row)" style="margin: 3px;">删除</el-button>
					</template>
				</el-table-column>
			</el-table>
			<div style="color: #B94A48;font-size: 20px;margin-top: 10px;display: inline-block;" v-if="totalMoney">
				本页累计交易统计：{{totalMoney}}元 ;
			</div>
			<div style="color: #B94A48;font-size: 20px;margin-top: 10px;display: inline-block;" v-if="rateZong">
				本页累计陪诊/陪护佣金统计：{{rateZong}}元 ;
			</div></br>
			<div style="color: #B94A48;font-size: 20px;margin-top: 10px;display: inline-block;" v-if="zhiRateZong">
				本页累计推广员佣金统计：{{zhiRateZong}}元 ;
			</div>
			<div style="color: #B94A48;font-size: 20px;margin-top: 10px;display: inline-block;" v-if="feiRateZong">
				本页累计代理商佣金统计：{{feiRateZong}}元 ;
			</div></br>
			<div style="color: #B94A48;font-size: 20px;margin-top: 10px;display: inline-block;" v-if="pingRateZong">
				本页累计平台金额统计：{{pingRateZong}}元 ;
			</div>
			<div style="text-align: center;margin-top: 10px;">
				<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
					:page-sizes="[10, 20, 30, 40]" :page-size="limit" :current-page="page"
					layout="total,sizes, prev, pager, next,jumper" :total="tableData.total">
				</el-pagination>
			</div>
		</el-tab-pane>
		<!-- 陪诊列表 -->
		<el-dialog title="陪诊列表" :visible.sync="dialogFormVisible" center width="80%">
			<div style="margin:5px;display: inline-block;">
				<span>手机号:</span>
				<el-input style="width: 150px;" @keydown.enter.native="selectU" clearable placeholder="请输入手机号"
					v-model="phone"></el-input>
			</div>
			<div style="margin:5px;display: inline-block;">
				<span>真实姓名:</span>
				<el-input style="width: 150px;" @keydown.enter.native="selectU" clearable placeholder="请输入昵称"
					v-model="campus"></el-input>
			</div>
			<div style="position: relative;display: inline-block;margin: 3px;">
				<span>性别：</span>
				<el-select v-model="sexU" style="width:150px;margin-left: 10px;" @change="selectU()">
					<el-option v-for="item in sexNum" :key="item.value" :label="item.label" :value="item.value">
					</el-option>
				</el-select>
			</div>
			<div style="margin:5px;display: inline-block;">
				<span>城市:</span>
				<el-input style="width: 150px;" @keydown.enter.native="selectU" clearable placeholder="请输入城市"
					v-model="cityU"></el-input>
			</div>
			<div style="display: inline-block;">
				<el-button style="margin-left:15px;" size="mini" type="primary" icon="document" @click="selectU">查询
				</el-button>
				<el-button style="margin-left:15px;" size="mini" type="primary" icon="document" @click="cleansU">重置
				</el-button>
			</div>
			<el-table v-loading="tableDataLoadingU" :data="userData.records">
				<el-table-column prop="userId" label="编号" width="80">
				</el-table-column>
				<el-table-column prop="userCertification.authentication" label="师傅类型">
					<template slot-scope="scope">
						<span
							v-if="scope.row.userCertification">{{scope.row.userCertification.authentication==1?'陪诊':'陪护'}}</span>
					</template>
				</el-table-column>
				<el-table-column prop="userName" label="昵称" width="120">
					<template slot-scope="scope">
						<!-- 　<span style="color: #4f9dec;cursor: pointer;" @click="updates(scope.row.userId)">
							{{scope.row.userName?scope.row.userName:'未绑定'}}
						</span> -->
						<el-button size="mini" style="color: #4f9dec;background: #fff;border: none;padding: 0;" type="primary"
							:disabled="!isAuth('userList:details')" @click="updates(scope.row.userId)">
							{{scope.row.userName ? scope.row.userName : '0'}}
						</el-button>
					</template>
				</el-table-column>
				<el-table-column prop="userName" label="真实姓名" width="120">
					<template slot-scope="scope">
						　<!-- <span style="color: #4f9dec;cursor: pointer;" @click="updates(scope.row.userId)">
							{{scope.row.userCertification?scope.row.userCertification.name:scope.row.userName}}
						</span> -->
						<el-button size="mini" style="color: #4f9dec;background: #fff;border: none;padding: 0;" type="primary"
							:disabled="!isAuth('userList:details')" @click="updates(scope.row.userId)">
							{{scope.row.userCertification?scope.row.userCertification.name:scope.row.userName}}
						</el-button>
					</template>
				</el-table-column>
				<el-table-column prop="avatar" label="用户头像" width="100">
					<template slot-scope="scope">
						　　<img v-if="scope.row.userCertification" :src="scope.row.userCertification.avatar" width="40"
							height="40" />
						<span v-else>暂无图片</span>
					</template>
				</el-table-column>
				<el-table-column prop="userCertification.phone" label="手机号">
				</el-table-column>
				<el-table-column prop="userCertification.sex" label="性别">
					<template slot-scope="scope">
						<span v-if="scope.row.userCertification">{{scope.row.userCertification.sex==1?'男':'女'}}</span>
					</template>
				</el-table-column>
				<el-table-column prop="" label="服务地区">
					<template slot-scope="scope">
						<span
							v-if="scope.row.userCertification">{{scope.row.userCertification.province}}{{scope.row.userCertification.city}}{{scope.row.userCertification.district}}</span>
					</template>
				</el-table-column>
				<el-table-column prop="userCertification.age" label="年龄">
				</el-table-column>
				<el-table-column prop="userCertification.workAge" label="护龄">
				</el-table-column>
				<el-table-column prop="levelName" label="等级">
				</el-table-column>
				<el-table-column prop="finalScore" label="评分">
				</el-table-column>
				<el-table-column prop="orderCount" label="接单量">
				</el-table-column>
				<el-table-column prop="workStatus" label="接单状态">
					<template slot-scope="scope">
						<span style="color: #008000;" v-if="scope.row.workStatus==0">空闲</span>
						<span style="color: #DD0000;" v-else>忙碌</span>
					</template>
				</el-table-column>
				<el-table-column prop="createTime" label="创建时间" width="180">
				</el-table-column>
				<el-table-column label="操作" prop="id" width="100" fixed='right' align="center">
					<template slot-scope="scope">
						<el-button size="mini" type="primary" @click="userBtns(scope.row)">确认
						</el-button>
					</template>
				</el-table-column>
			</el-table>
			<div style="text-align: center;margin-top: 10px;">
				<el-pagination @size-change="handleSizeChangeU" @current-change="handleCurrentChangeU"
					:page-sizes="[10, 20, 30, 40]" :page-size="limit1" :current-page="page1"
					layout="total,sizes, prev, pager, next,jumper" :total="userData.total">
				</el-pagination>
			</div>
		</el-dialog>
		<!-- 信息详情 -->
		<el-dialog :title="titles" :visible.sync="dialogFormVisibleDel" center width="80%">
			<el-row>
				<el-col :span="8" class="cards">
					<div class="box">
						<div class="box_num">
							<div class="box_color">就诊人姓名</div>
							<div class="text_color"><span style="cursor: pointer;color: #4f9dec;"
									v-if="detaDatle.patientInfo"
									@click="updates(detaDatle.patientInfo.userId)">{{detaDatle.patientInfo.realName}}</span>
							</div>
						</div>
					</div>
				</el-col>
				<el-col :span="8" class="cards">
					<div class="box">
						<div class="box_num">
							<div class="box_color">就诊人电话</div>
							<div class="text_color"><span
									v-if="detaDatle.patientInfo">{{detaDatle.patientInfo.phone}}</span></div>
						</div>
					</div>
				</el-col>
				<el-col :span="8" class="cards">
					<div class="box">
						<div class="box_num">
							<div class="box_color">紧急联系人电话</div>
							<div class="text_color"><span
									v-if="detaDatle.patientInfo">{{detaDatle.patientInfo.emergencyPhone?detaDatle.patientInfo.emergencyPhone:'暂无'}}</span>
							</div>
						</div>
					</div>
				</el-col>
				<el-col :span="8" class="cards">
					<div class="box">
						<div class="box_num">
							<div class="box_color">身份证号</div>
							<div class="text_color"><span
									v-if="detaDatle.patientInfo">{{detaDatle.patientInfo.idNumber}}</span></div>
						</div>
					</div>
				</el-col>
				<el-col :span="8" class="cards">
					<div class="box">
						<div class="box_num">
							<div class="box_color">性别</div>
							<div class="text_color"><span
									v-if="detaDatle.patientInfo">{{detaDatle.patientInfo.sex==1?'男':'女'}}</span></div>
						</div>
					</div>
				</el-col>
				<el-col :span="8" class="cards">
					<div class="box">
						<div class="box_num">
							<div class="box_color">是否满18岁</div>
							<div class="text_color"><span
									v-if="detaDatle.patientInfo">{{detaDatle.patientInfo.isUnderAge==1?'是':'否'}}</span>
							</div>
						</div>
					</div>
				</el-col>
				<el-col :span="8" class="cards">
					<div class="box">
						<div class="box_num">
							<div class="box_color">与下单人的关系</div>
							<div class="text_color"><span
									v-if="detaDatle.patientInfo">{{detaDatle.patientInfo.relationship}}</span></div>
						</div>
					</div>
				</el-col>

				<el-col :span="8" class="cards">
					<div class="box">
						<div class="box_num">
							<div class="box_color">床号</div>
							<div class="text_color">
								<span>{{detaDatle.badNo?detaDatle.badNo:'-'}}</span>
							</div>
						</div>
					</div>
				</el-col>
				<el-col :span="8" class="cards">
					<div class="box">
						<div class="box_num">
							<div class="box_color">症状</div>
							<div class="text_color"><span>{{detaDatle.symptom?detaDatle.symptom:'-'}}</span>
							</div>
						</div>
					</div>
				</el-col>
				<el-col :span="8" class="cards">
					<div class="box">
						<div class="box_num">
							<div class="box_color">自理能力</div>
							<div class="text_color"><span>{{detaDatle.selfAbility?detaDatle.selfAbility:'-'}}</span>
							</div>
						</div>
					</div>
				</el-col>
				<el-col :span="8" class="cards">
					<div class="box">
						<div class="box_num">
							<div class="box_color">护理需求</div>
							<div class="text_color"><span>{{detaDatle.nursingNeeds?detaDatle.nursingNeeds:'-'}}</span>
							</div>
						</div>
					</div>
				</el-col>
				<el-col :span="8" class="cards">
					<div class="box">
						<div class="box_num">
							<div class="box_color">护理天数</div>
							<div class="text_color"><span>{{detaDatle.serviceNum?detaDatle.serviceNum:'-'}}</span></div>
						</div>
					</div>
				</el-col>
				<el-col :span="8" class="cards">
					<div class="box">
						<div class="box_num">
							<div class="box_color">备注</div>
							<div class="text_color"><span>{{detaDatle.remarks?detaDatle.remarks:'-'}}</span></div>
						</div>
					</div>
				</el-col>
			</el-row>


		</el-dialog>
		<!-- 修改备注时间 -->
		<el-dialog title="修改备注时间" :visible.sync="dialogFormVisibleBz" center>
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">预约时间：</span>
				<el-date-picker style="width: 50%;" v-model="serveTime" align="right" type="datetime"
					format="yyyy-MM-dd HH:mm" value-format="yyyy-MM-dd HH:mm" placeholder="选择开始时间">
				</el-date-picker>&nbsp;&nbsp;&nbsp;
			</div>
			<div style="margin-bottom: 10px;">
				<span
					style="width: 200px;display: inline-block;text-align: right;position: relative;top: -70px;">备注：</span>
				<el-input style="width:50%;" v-model="content" type="textarea" :rows="4" placeholder="请输入备注">
				</el-input>
			</div>
			<div slot="footer" class="dialog-footer">
				<el-button @click="dialogFormVisibleBz = false">取 消</el-button>
				<el-button type="primary" @click="replyNoticeTo()">确 定</el-button>
			</div>
		</el-dialog>
		<!-- 部分退款 -->
		<el-dialog title="部分退款" :visible.sync="dialogFormVisibleTk" center>
			<div style="margin-bottom: 10px;">
				<span style="width: 200px;display: inline-block;text-align: right;">退款金额：</span>
				<el-input style="width:50%;" v-model="content" type="number" min="0" placeholder="请输入退款金额">
				</el-input></br>
				<span style="color: red;margin-left: 200px;">* 当前订单支付金额为：{{datasD.payMoney}}</span>
			</div>
			<div slot="footer" class="dialog-footer">
				<el-button @click="dialogFormVisibleTk = false">取 消</el-button>
				<el-button type="primary" @click="replyNoticeToTk()">确 定</el-button>
			</div>
		</el-dialog>


	</el-tabs>
</template>

<script>
	export default {
		data() {
			return {
				limit: 10,
				page: 1,
				limit1: 10,
				page1: 1,
				state: 2,
				status: '',
				userNameX: '',
				userName: '',
				type: '',
				id: '',
				statesnum: [{
						value: '',
						label: '全部'
					},
					{
						value: 0,
						label: '待支付'
					},
					{
						value: 1,
						label: '进行中'
					},
					{
						value: 5,
						label: '待服务'
					},
					{
						value: 2,
						label: '已完成'
					},
					{
						value: 3,
						label: '已退款'
					},
					{
						value: 4,
						label: '待接单'
					}
				],
				typeNum: [{
						value: '',
						label: '全部'
					},
					{
						value: 1,
						label: '陪诊订单'
					},
					{
						value: 2,
						label: '陪护订单'
					},
				],

				activeName: 'first',
				tableDataLoading: false,
				tableDataLoadingU: false,
				dialogFormVisible1: false,
				dialogFormVisible2: false,
				dialogFormVisible: false,
				tableData: {},
				ordersNo: '',
				info: {
					stockDate: this.getNowTime(), //日期
				},
				info2: {
					stockDate2: this.getNowTime2(), //日期
				},
				startTime: '',
				endTime: '',
				userData: {},
				phone: '',
				campus: '',
				ordersId: '',
				pd: '',
				titles: '信息详情',
				dialogFormVisibleDel: false,
				detaDatle: {},
				datleIndex: 1,
				hospitalId: '',
				hospitalList: [],

				totalMoney: 0,
				rateZong: 0,
				zhiRateZong: 0,
				feiRateZong: 0,
				pingRateZong: 0,
				// 修改备注，时间
				dialogFormVisibleBz: false,
				ordersId: '',
				content: '',
				serveTime: '',
				dialogFormVisibleTk: false,
				datasD: {},
				ordersType: 1,
				sexU: '',
				sexNum: [{
						value: '',
						label: '全部'
					},
					{
						value: 1,
						label: '男'
					},
					{
						value: 2,
						label: '女'
					},
				],
				cityU: '',

			}
		},
		methods: {
			//处理默认选中当前日期
			getNowTime() {
				var now = new Date()
				var year = now.getFullYear() //得到年份
				var month = now.getMonth() //得到月份
				var date = now.getDate() //得到日期
				month = month + 1
				month = month.toString().padStart(2, '0')
				date = date.toString().padStart(2, '0')
				var defaultDate = `${year}-${month}-${date}`
				return defaultDate
				this.$set(this.info, 'stockDate', defaultDate)
			},
			//处理默认选中当前日期
			getNowTime2() {
				var now = new Date()
				var year = now.getFullYear() //得到年份
				var month = now.getMonth() - now.getMonth() //得到月份
				var date = now.getDate() - now.getDate() + 1 //得到日期
				month = month + 1
				month = month.toString().padStart(2, '0')
				date = date.toString().padStart(2, '0')
				var defaultDate = `${year}-${month}-${date}`
				return defaultDate
				this.$set(this.info, 'stockDate', defaultDate)
			},

			handleSizeChange(val) {
				this.limit = val;
				this.dataSelect()
			},
			handleCurrentChange(val) {
				this.page = val;
				this.dataSelect()
			},
			handleSizeChangeU(val) {
				this.limit1 = val;
				this.dataSelectUser()()
			},
			handleCurrentChangeU(val) {
				this.page1 = val;
				this.dataSelectUser()
			},
			handleClick(tab, event) {
				if (tab._props.label == '订单中心') {
					this.page = 1
					this.limit = 10
					this.dataSelect()
				}
			},

			// 获取数据列表
			dataSelect() {
				this.totalMoney = 0
				this.rateZong = 0
				this.zhiRateZong = 0
				this.feiRateZong = 0
				this.pingRateZong = 0
				this.tableDataLoading = true
				var endTime = this.endTime
				if (this.endTime != '') {
					endTime = this.endTime + " 23:59:59"
				}
				this.$http({
					url: this.$http.adornUrl('orders/queryOrders'),
					method: 'get',
					params: this.$http.adornParams({
						'page': this.page,
						'limit': this.limit,
						'type': this.type,
						'userName': this.userName,
						'status': this.status,
						'ordersNo': this.ordersNo,
						'startTime': this.startTime,
						'endTime': endTime,
						'hospitalId': this.hospitalId,
						'name': this.userNameX,
						'shopId': sessionStorage.getItem('shopId'),
					})
				}).then(({
					data
				}) => {
					this.tableDataLoading = false
					let returnData = data.data;
					if(data.data){
						this.tableData = returnData
						this.tableData.records.map(item => {
							item.goodsPriceZ = 0
							this.totalMoney = this.totalMoney + item.payMoney
						
							this.rateZong = this.rateZong + Number(item.rate)
							this.zhiRateZong = this.zhiRateZong + Number(item.zhiRate)
							this.feiRateZong = this.feiRateZong + Number(item.feiRate)
							this.pingRateZong = this.pingRateZong + Number(item.pingRate)
						
						
						
						})
						this.totalMoney = this.totalMoney.toFixed(2)
						this.rateZong = this.rateZong.toFixed(2)
						this.zhiRateZong = this.zhiRateZong.toFixed(2)
						this.feiRateZong = this.feiRateZong.toFixed(2)
						this.pingRateZong = this.pingRateZong.toFixed(2)
					}else{
						this.tableData.records = []
					}
					
				})
			},
			// 详情跳转
			updates(userId) {
				if (userId) {
					this.$router.push({
						path: '/userDetail',
						query: {
							userId: userId
						}
					})
				}
			},
			// 查询
			select() {
				this.page = 1
				this.limit = 10
				this.dataSelect()
			},
			// 重置
			cleans() {
				this.userName = ''
				this.status = ''
				this.type = ''
				this.ordersNo = ''
				this.startTime = ''
				this.endTime = ''
				this.hospitalId = ''
				this.userNameX = ''
				this.page = 1
				this.dataSelect()
			},
			// select选择事件
			animeDat(state) {
				this.page = 1
				this.dataSelect()
			},
			// 删除订单
			deletes(row) {
				let delid = row.ordersId
				this.$confirm(`确定删除此条信息?`, '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					this.$http({
						url: this.$http.adornUrl(`orders/deleteOrders?id=${delid}`),
						method: 'post',
						params: this.$http.adornParams({})
					}).then(({
						data
					}) => {
						if (data.code == 0) {
							this.$message({
								message: '删除成功',
								type: 'success',
								duration: 1500,
								onClose: () => {
									this.dataSelect()
								}
							})
						} else {
							this.$message({
								message: data.msg,
								type: 'error',
								duration: 1500,
								onClose: () => {}
							})
						}

					})
				})
			},
			// 退款
			tuikuanBtn(row, index) {
				if (index === 0) {
					this.content = ''
				}
				let delid = row.ordersId
				this.$confirm(`确定要进行退款操作?`, '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					this.$http({
						url: this.$http.adornUrl(`orders/cancelOrder?id=${row.ordersId}&status=3`),
						method: 'get',
						params: this.$http.adornParams({
							'refundMoney': this.content
						})
					}).then(({
						data
					}) => {
						if (data.code == 0) {
							this.$message({
								message: '操作成功',
								type: 'success',
								duration: 1500,
								onClose: () => {
									this.dialogFormVisibleTk = false
									this.dataSelect()
								}
							})
						} else {
							this.$message({
								message: data.msg,
								type: 'warning',
								duration: 1500,
								onClose: () => {}
							})
						}
					})
				})
			},
			// 部分退款
			tuikuanBtn2(row) {
				this.content = ''
				this.datasD = row
				this.dialogFormVisibleTk = true
			},
			// 退款
			replyNoticeToTk() {

				if (this.content === '') {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '退款金额不能为空',
						type: 'warning'
					});
					return
				}
				this.content = Number(this.content)
				if (this.content == 0) {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '退款金额不能小于0或者等于0',
						type: 'warning'
					});
					return
				}
				if (this.content < 0) {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '退款金额不能小于0或者等于0',
						type: 'warning'
					});
					return
				}

				if (this.content > this.datasD.payMoney) {
					this.$notify({
						title: '提示',
						duration: 1800,
						message: '退款金额不能大于支付金额',
						type: 'warning'
					});
					return
				} else {
					this.tuikuanBtn(this.datasD, 1)
				}

			},

			//取消订单/取消接单
			qvxiao(id, name) {
				let status = ''
				if (name = '取消订单') {
					status = 3
				} else {
					status = 4
				}
				this.$confirm('是否确认' + name + '?', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					this.$http({
						url: this.$http.adornUrl(`orders/cancelOrder?id=${id}&status=${status}`),
						method: 'get',
						params: this.$http.adornData({})
					}).then(({
						data
					}) => {
						if (data.code == 0) {
							this.$message({
								message: '操作成功',
								type: 'success',
								duration: 1500,
								onClose: () => {
									this.dataSelect()
								}
							})
						} else {
							this.$message({
								message: data.msg,
								type: 'warning',
								duration: 1500,
								onClose: () => {}
							})
						}
					})
				})
			},
			// 餐品完成
			wancheng(row) {
				this.$confirm(`是否确认完成订单?`, '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					this.$http({
						url: this.$http.adornUrl(`orders/cancelOrder?id=${row.ordersId}&status=2`),
						method: 'get',
						params: this.$http.adornData({})
					}).then(({
						data
					}) => {
						if (data.code == 0) {
							this.$message({
								message: '操作成功',
								type: 'success',
								duration: 1500,
								onClose: () => {
									this.dataSelect()
								}
							})
						} else {
							this.$message({
								message: data.msg,
								type: 'warning',
								duration: 1500,
								onClose: () => {}
							})
						}
					})
				})
			},
			// 导出
			exportBtn() {
				var endTime = this.endTime
				if (this.endTime != '') {
					endTime = this.endTime + " 23:59:59"
				}
				this.$http({
					url: this.$http.adornUrl('orders/ordersListExcel'),
					method: 'get',
					responseType: 'blob',
					params: this.$http.adornParams({
						// 'page': page,
						// 'size': this.size,
						'type': this.type,
						'name': this.userName,
						'status': this.status,
						'ordersNo': this.ordersNo,
						'startTime': this.startTime,
						'endTime': endTime,
					})
				}).then(({
					data
				}) => {
					let blob = new Blob([data], {
						type: 'application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
					})
					if (window.navigator.msSaveOrOpenBlob) {
						navigator.msSaveBlob(blob)
					} else {
						let url = window.URL.createObjectURL(blob)
						let elink = document.createElement('a')
						elink.download = '订单列表.xlsx'
						elink.style.display = 'none'
						elink.href = url
						document.body.appendChild(elink)
						elink.click()
						document.body.removeChild(elink)
					}
				})
			},
			// 转单弹框
			zhuandan(row, pd) {
				this.ordersId = row.ordersId
				this.ordersType = row.ordersType
				if (pd) {
					this.pd = pd
				} else {
					this.pd = ''
				}

				this.dataSelectUser()
				this.dialogFormVisible = true
			},
			// 确认选择
			userBtns(row) {
				let url = ''
				if (this.pd) {
					url = 'orders/distributionOrder'
				} else {
					url = 'orders/giveOrdersUser'
				}
				this.$http({
					url: this.$http.adornUrl(url),
					method: 'post',
					params: this.$http.adornParams({
						'userId': row.userId,
						'orderId': this.ordersId,
					})
				}).then(({
					data
				}) => {
					if (data.code == 0) {
						this.$message({
							message: '操作成功',
							type: 'success',
							duration: 1500,
							onClose: () => {
								this.dataSelect()
								this.dialogFormVisible = false
							}
						})
					} else {
						this.$message({
							message: data.msg,
							type: 'warning',
							duration: 1500,
							onClose: () => {}
						})
					}


				})
			},
			// 获取数据列表
			dataSelectUser() {
				this.tableDataLoadingU = true
				var authentication = ''
				if (this.ordersType == 1) {
					authentication = ''
				} else {
					authentication = 2
				}
				this.$http({
					url: this.$http.adornUrl('user/getNursingListV5'),
					method: 'get',
					params: this.$http.adornParams({
						'page': this.page1,
						'limit': this.limit1,
						'city': this.cityU,
						'phone': this.phone,
						'realName': this.campus,
						'sex': this.sexU,
						'authentication': authentication,
						'shopId': sessionStorage.getItem('shopId'),
					})
				}).then(({
					data
				}) => {
					this.tableDataLoadingU = false
					let returnData = data.data
					if(data.data){
						this.userData = returnData
					}else{
						this.userData.records = []
					}
					
				})
			},
			// 查询
			selectU() {
				this.page = 1
				this.dataSelectUser()
			},
			// 重置
			cleansU() {
				this.page1 = 1
				this.campus = ''
				this.phone = ''
				this.sexU = ''
				this.cityU = ''
				this.dataSelectUser()
			},
			dataDel(row, index) {
				console.log(row)
				// if(index==1){
				// 	this.titles = '快递员信息'
				// }
				// if(index==2){
				// 	this.titles = '寄件人信息'
				// }
				// if(index==3){
				// 	this.titles = '收件人信息'
				// }
				// if(index==4){
				// 	this.titles = '申诉信息'
				// }
				// if(index==5){
				// 	this.titles = '物品信息'
				// }
				// if(index==6){
				this.titles = '就诊信息'
				// }
				this.datleIndex = index
				this.detaDatle = row
				this.dialogFormVisibleDel = true
			},
			// 医院列表
			dataSelectHospitalList() {
				this.$http({
					url: this.$http.adornUrl('admin/hospital/getHospitalList'),
					method: 'get',
					params: this.$http.adornParams({
						// 'province': this.province,
						// 'city': this.city,
						// 'district': this.district
					})
				}).then(({
					data
				}) => {
					if(data.data){
						this.hospitalList = data.data.records
					}else{
						this.hospitalList = []
					}
					
					console.log(data, '```````', this.hospitalList)

				})
			},
			// 修改备注、时间
			updateBz(row) {
				this.ordersId = row.ordersId
				this.serveTime = row.hopeTime
				this.content = row.remarks
				this.dialogFormVisibleBz = true
			},
			// 修改
			replyNoticeTo() {

				this.$http({
					url: this.$http.adornUrl('admin/Information/updateInformation'),
					method: 'post',
					params: this.$http.adornParams({
						// data: this.$http.adornData({
						'ordersId': this.ordersId,
						'hopeTime': this.serveTime,
						'remarks': this.content,
					})
				}).then(({
					data
				}) => {
					if (data.code == 0) {
						this.$message({
							message: '修改成功',
							type: 'success',
							duration: 1500,
							onClose: () => {
								this.dataSelect()
							}
						})
						this.dialogFormVisibleBz = false
					} else {
						this.$message({
							message: data.msg,
							type: 'warning',
							duration: 1500,
							onClose: () => {}
						})
					}

				})
			},
		},
		mounted() {
			if (this.$route.query.hospitalId) {
				this.hospitalId = Number(this.$route.query.hospitalId)
			} else {
				this.hospitalId = ''
			}
			this.dataSelect()
			this.dataSelectHospitalList()
		}
	};
</script>

<style>
	.customWidth {
		width: 80% !important;
	}

	.detailtabel .table_main table {
		width: 100%;
	}

	.detailtabel .table_main {
		border: 1px solid #e8e8e8;
	}

	.detailtabel table tr {
		border-bottom: 1px solid #e8e8e8;
	}

	.detailtabel table tr th {
		background-color: #fafafa;
		padding: 16px 24px;
		border-right: 1px solid #e8e8e8;
		border-bottom: 1px solid #e8e8e8;
	}

	.detailtabel table tr td {
		padding: 16px 24px;
		border-right: 1px solid #e8e8e8;
		border-bottom: 1px solid #e8e8e8;
	}

	.detailtabel table th {
		color: rgba(0, 0, 0, .85);
		font-weight: 400;
		font-size: 14px;
		line-height: 1.5;
	}

	.border-rt {
		border-right: none !important;
	}

	.border-bt {
		border-bottom: none !important;
	}

	.box {
		padding: 44px;
		border: 1px solid #eee;
		margin: 15px 10px;
	}

	.box_num {
		font-size: 14px;
		color: #66b1ff;
	}

	.box_num .box_color {
		color: #333;
		font-size: 14px;
		margin-bottom: 15px;
	}

	.box_num div span {
		font-size: 20px;
		margin-left: 5px;
	}

	.text_color {
		color: #4f9dec;
	}

	.text_color span {
		margin-right: 5px;
	}

	.el-step.is-vertical .el-step__title {
		padding-bottom: 30px !important;
	}
</style>